package com.jacars.gateway.request;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jacars.gateway.model.GatewayRoute;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

//import com.jacars.gateway.base.BaseParam;

//@EqualsAndHashCode(callSuper = true)
@Setter
@Getter
//@Data
//@AllArgsConstructor
//@NoArgsConstructor
public class GatewayRouteQueryParam extends GatewayRoute {
    private String uri;

    private Date createdTimeStart;
    private Date createdTimeEnd;

    public GatewayRouteQueryParam(String uri) {
        this.uri = uri;
    }

    public QueryWrapper<GatewayRoute> build() {
        QueryWrapper<GatewayRoute> queryWrapper = new QueryWrapper<>();
        queryWrapper.ge(null != this.createdTimeStart, "created_time", this.createdTimeStart)
                .le(null != this.createdTimeEnd, "created_time", this.createdTimeEnd);
        return queryWrapper;
    }
}
